<?php
include("db.conf.php");
require 'PHPMailerAutoload.php';


$sCourseName='2014_w_cal';

$sqlConnect=new mysqli($sServer,$sUser,$sPassword,$sDatabaseName);
$sqlConnect->query("SET NAMES 'UTF8");

$objMail = new PHPMailer;

$objMail->isSMTP();                                      // Set mailer to use SMTP
$objMail->Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
$objMail->SMTPAuth = true;                               // Enable SMTP authentication
$objMail->Username = 'quanghm';                 // SMTP username
$objMail->Password = 'quang6van21';                           // SMTP password
$objMail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$objMail->Port = 587;                                    // TCP port to connect to

$objMail->From = 'qhoang@skku.edu';
$objMail->FromName = 'Quang Hoang';
$objMail->addAddress('quanghm@gmail.com', 'Quang Hoang');     // Add a recipient
$objMail->addAddress('ellen@example.com');               // Name is optional
$objMail->addReplyTo('qhoang@skku.edu', 'Quang Hoang');
//$objMail->addCC('cc@example.com');
//$objMail->addBCC('bcc@example.com');

//$objMail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
//$objMail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
$objMail->isHTML(true);                                  // Set email format to HTML

$objMail->Subject = 'Here is the subject';
$objMail->Body    = 'This is the HTML message body <b>in bold!</b>';
$objMail->AltBody = 'This is the body in plain text for non-HTML mail clients';

if(!$objMail->send()) {
	echo 'Message could not be sent.';
	echo 'Mailer Error: ' . $objMail->ErrorInfo;
} else {
	echo 'Message has been sent';
}
?>